
CREATE TABLE TEACHERS (
	ID UNIQUEIDENTIFIER DEFAULT NEWID() PRIMARY KEY,
	SURNAME NVARCHAR(100),
	NAME NVARCHAR(100),
	PATRONYMIC NVARCHAR(100),
	DEPARTMENT NVARCHAR(100)
);

CREATE TABLE GROUPS (
	ID UNIQUEIDENTIFIER DEFAULT NEWID() PRIMARY KEY,
	CourseNumber NVARCHAR(10),
	Speciality NVARCHAR(100),
	GroupNumber NVARCHAR(10),
	SubGroup nvarchar(50)
);

CREATE TABLE SUBJECTS (
	ID UNIQUEIDENTIFIER DEFAULT NEWID() PRIMARY KEY,
	NAME NVARCHAR(100)
);

CREATE TABLE RINGS (
	ID UNIQUEIDENTIFIER DEFAULT NEWID() PRIMARY KEY,
	NUMBER INT,
	START NVARCHAR(50),
	FINISH NVARCHAR(50)
);

CREATE TABLE CLASSROOMTYPES (
	ID UNIQUEIDENTIFIER DEFAULT NEWID() PRIMARY KEY,
	NAME NVARCHAR(100)
);

CREATE TABLE CLASSROOMS (
	ID UNIQUEIDENTIFIER DEFAULT NEWID() PRIMARY KEY,
	NUMBER NVARCHAR(20),
	CTYPE UNIQUEIDENTIFIER REFERENCES CLASSROOMTYPES(ID)
);

CREATE TABLE LESSONS (
	ID UNIQUEIDENTIFIER DEFAULT NEWID() PRIMARY KEY,
	SUBJECT_ UNIQUEIDENTIFIER REFERENCES SUBJECTS(ID),
	TEACHER_ UNIQUEIDENTIFIER REFERENCES TEACHERS(ID),
	GROUP_ UNIQUEIDENTIFIER REFERENCES GROUPS(ID),
	CLRT_ UNIQUEIDENTIFIER REFERENCES CLASSROOMTYPES(ID)
);